<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>
  <script>
    // 1.开始循环
    let sum = 0
    while (true) {
      let re = +prompt(`
      请你选择操作
      1、存钱
      2、取钱
      3、查看余额
      4、退出
      `)
      switch (re) {
        case 1:
          let num_add = +prompt('存多少钱：')
          sum += num_add
          alert('存钱成功！')
          break
        case 2:
          let num_del = +prompt('取多少钱：')
          sum -= num_del
          alert('取钱成功！')
          break
        case 3:
          alert(`你现在还有${sum}元`)
          break
        case 4:
          alert('退出成功！')
          break
        default:
          alert('请输入正确的序号！')
      }
      if (re === 4) {
        break
      }
    }
  </script>
</body>

</html>